﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sealight.Core.DataAdapter;

namespace Sealight.Core.Domain
{
  public  class ProductCategoryEntity:BaseEntity
    {
        /// <summary>
        /// Gets or sets the ProductCategory identifier
        /// </summary>
        public virtual Guid ProductCategoryID { get; set; }

        /// <summary>
        /// Gets or sets the product identifier
        /// </summary>
        public virtual ProductEntity Product { get; set; }

        /// <summary>
        /// Gets or sets the category identifier
        /// </summary>
        public virtual CategoryEntity Category { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether the product is featured
        /// </summary>
        public virtual bool IsFeaturedProduct { get; set; }

        /// <summary>
        /// Gets or sets the display order
        /// </summary>
        public virtual int DisplayOrder { get; set; }

        public virtual Sealight.Core.DataAdapter.product_category_map ToDataAdapter()
        {
            product_category_map data = new product_category_map { id = this.ProductCategoryID, display_order = this.DisplayOrder,
                is_featured_product = this.IsFeaturedProduct, 
                product = new Sealight.Core.DataAdapter.product { id = this.Product.ProductID } };

            if (this.Category != null)
            {
                data.category = this.Category.ToDataAdapter();
            }

            return data;
        }
    }
}
